package org.dzq.designmode.builder;

/**
 * @ClassName: CakeBuilder
 * @Package: org.dzq.designmode.builder
 * @author: 越
 * @date: 2023/6/13 21:03
 * @Description: 角色：具体建造者
 */
public class CakeBuilder implements Builder{

    private Cake cake;

    public CakeBuilder(){
        this.cake = new Cake();
    }

    @Override
    public CakeBuilder setCake(Cake cake) {
        this.cake = cake;
        return this;
    }

    @Override
    public Builder addCrust() {
        this.cake.setAddCrust(true);
        return this;
    }

    @Override
    public Builder addCream() {
        this.cake.setAddCream(true);
        return this;
    }

    @Override
    public Builder addChocolate() {
        this.cake.setAddChocolate(true);
        return this;
    }

    @Override
    public Builder addCocoaPowder() {
        this.cake.setAddCocoaPowder(true);
        return this;
    }

    @Override
    public Builder addCheese() {
        this.cake.setAddCheese(true);
        return this;
    }

    @Override
    public Builder addCoffeeWine() {
        this.cake.setAddCoffeeWine(true);
        return this;
    }

    @Override
    public Builder addFruit() {
        this.cake.setAddFruit(true);
        return this;
    }

    @Override
    public Cake buildCake() {
        return this.cake;
    }
}
